package newfeature.jdk9;

/**
 * Created by dl
 */
public class IntefacePrivateMethod {

	public static void main(String[] args) {
		System.out.println(new TimesImpl().doubleIt(" 2.3"));
	}

	static interface Times {
		default  double doubleIt(String s) {
			return convert(s)*2;
		}

		default double tripleIt(String s) {
			return convert(s)*3;
		}

		// 主要用在interface中多个default方法里被复用的自定义方法，而该方法不想暴露为public
		private double convert(String s){
			return Double.parseDouble(s.trim());
		}
	}

	static class TimesImpl implements Times {

	}
}